package com.mlnx.web.data.controller;


import com.mlnx.data.enums.OblCodeEnum;
import com.mlnx.data.pojo.form.OblBpInfoForm;
import com.mlnx.data.pojo.vo.OblResponseVo;
import com.mlnx.data.service.WaiBuBpService;

import org.shan.spring.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * Created by amanda.shan on 2017/10/26.
 */
@Api(value = "欧宝莱血压数据接口", tags={"欧宝莱血压数据接口"})
@RestController
@RequestMapping("/mlnx_data/obl")
public class OBLController extends BaseController {

    @Autowired
    private WaiBuBpService gprsBpService;

    @ApiOperation(value = "上传血压数据", notes = "")
    @RequestMapping(value = "/sendbp", method = {RequestMethod.GET, RequestMethod.POST})
    public OblResponseVo sendOblBpData(OblBpInfoForm oblBpInfoForm) {

        return gprsBpService.saveOrbBpDeviceInfo(oblBpInfoForm);
    }

    @ApiOperation(value = "同步时间", notes = "")
    @RequestMapping(value = "/synTime", method = {RequestMethod.GET, RequestMethod.POST})
    public OblResponseVo synTime() {

        SimpleDateFormat orbResponseFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        OblResponseVo orbResponse = new OblResponseVo(OblCodeEnum.SUCCESS.getCode(), orbResponseFormat.format(new Date()));

        return orbResponse;
    }
}
